<?php
$taskIds = $_POST['TaskId'];
if(empty($taskIds)) {
    echo "参数错误";
    exit();
}

$dsn = "sqlsrv:Server=localhost;Database=Task";
$db = new PDO($dsn, "sa", "123456");

$sql = "delete from Task where TaskId in (" . implode(",", $taskIds) . ") and TaskStatus = 1 ";
$result = $db->exec($sql);
if ($result) {
    echo "批量删除成功<br />";
    echo "<a href='task_list.php'>返回列表页面</a>";
}